//
//  LoopUIview+ExtenSion.swift
//  LoopWeibo
//
//  Created by loop安 on 2016/12/29.
//  Copyright © 2016年 loop. All rights reserved.
//

import UIKit

extension UIView{
    
    func findNavigationController()->UINavigationController?{
    
        var respond = self.next
        while respond != nil{
            if let obj = respond as? UINavigationController{
                return obj
            }
            respond = respond?.next
        
        }
    return nil
    }
    
    func findViewController()->UIViewController?{
        
        var respond = self.next
        while respond != nil{
            if let obj = respond as? UIViewController{
                return obj
            }
            respond = respond?.next
            
        }
        return nil
    }

}
